/**
 *
 */
package wsepForum.ui.jaxcent;

import jaxcent.JaxcentPage;
import wsepForum.common.elements.Section;
import wsepForum.common.elements.User.UserType;
import wsepForum.domain.Session;
import wsepForum.ui.jaxcent.states.XEditor.ActionType;

/**
 * Used by XState to do functions on the page/get data/get relevant access
 * @author Oren
 *
 */
public interface IXContext {

	/**
	 * @return the page connector
	 */
	public JaxcentPage getPage();
	/**
	 * @return the relevant domain session
	 */
	public Session getSession();

	/**
	 * loads section to the page by ID
	 */
	public void loadSection(int sectionId);

	/**
	 * loads section to the page by object
	 */
	public void loadSection(Section section);

	/**
	 * display login page
	 */
	public void loadLogin();

	/**
	 * display user details page
	 */
	public void loadUserDetails();

	/**
	 * display stats page
	 */
	public void loadStats();

	/**
	 * load search page
	 */
	public void loadSearch();

	/**
	 * load a topic to page by id
	 * @param topicId topic id
	 * @param msgId message id(if 0 load page without focusing a message)
	 */
	public void loadTopic(int topicId, int msgId);

	/**
	 * load message editor
	 * @param type the type of the editor(post new topic,new message,edit message,reply message)
	 * @param parameters relevant parameters per type
	 */
	public void loadEditor(ActionType type, Object[] parameters);


	/**
	 * load section create/edit page
	 * @param section relevant section
	 * @param isNew if true, opens the create section
	 */
	public void loadSectionControl(Section section, boolean isNew);

	/**
	 * sets the inner body in the page to a specific string
	 */
	public void setBody(String newBody);

	/**
	 * @return the user type (admin, moderator, member..)
	 */
	public UserType getUserType();

	/**
	 * returns the user name
	 */
	public String getUserName();

	/**
	 * inform the page with the section change
	 * @param sectionId the changed section
	 * @param section the name of the section, can be null(will try get it itself)
	 */
	public void setSection(int sectionId, String sectionName);

	/**
	 * initiate login sequence
	 */
	public void loginUser(String user, String password);

	/**
	 *initiate logout sequence
	 */
	public boolean logoutUser(boolean quietLogout);
}
